export const DICT_TYPE = {
    F_TYPE: 'fType'
}

const dataObj = {
    'fType': [{
        name: '食品',
        val: 'Food'
    },
    {
        name: '食用农产品',
        val: 'FoodFarm'
    },
    {
        name: '食品添加剂',
        val: 'FoodAdd'
    },
    {
        name: '食品相关',
        val: 'FoodRelate'
    }],
    'bdType': [
        {
            name: '入库变动',
            val: 'In'
        },
        {
            name: '出库变动',
            val: 'Out'
        },
        {
            name: '入库删除变动',
            val: 'In_del'
        },
        {
            name: '出库删除变动',
            val: 'Out_del'
        }
    ],
    'jlType': [{
        name: '热力消毒记录',
        val: 'Thermal'
    },
    {
        name: '化学消毒记录',
        val: 'Chemistry'
    },
    {
        name: '场所消毒记录',
        val: 'Place'
    }
    ],
    'gysType': [{
        name: '生产企业',
        val: 'Manufacturer'
    },
    {
        name: '经营单位',
        val: 'BusinessUnit'
    },
    {
        name: '食用农产品生产者',
        val: 'FoodProducer'
    },
    {
        name: '屠宰企业',
        val: 'Butcher'
    },
    {
        name: '个体工商户',
        val: 'SelfEmployed'
    }
    ],
    'zcType': [{
        name: '常规自查',
        val: 'Normal'
    },
    {
        name: '全项自查',
        val: 'All'
    },
    {
        name: '全项自查整改报告',
        val: 'Report'
    }
    ],
    'jlAqType': [
        {
            name: '风险管控清单',
            val: 'Risk'
        },
        {
            name: '每日检查记录',
            val: 'Day'
        },
        {
            name: '每周治理报告',
            val: 'Week'
        },
        {
            name: '每月会议纪要',
            val: 'Month'
        },
    ]
}

export function getDictDatas(dictType) {
    // 获取 dictType 对应的数据字典数组
    const dictDatas = dataObj[dictType]
    return dictDatas || []
}

export function getDictData(dictType, value) {
    // 获取 dictType 对应的数据字典数组
    const dictDatas = dataObj[dictType]
    if (!dictDatas || dictDatas.length === 0) {
        return ''
    }
    // 获取 value 对应的展示名
    value = value + '' // 强制转换成字符串，因为 DictData 小类数值，是字符串
    for (const dictData of dictDatas) {
        if (dictData.val === value) {
            return dictData.name;
        }
    }
    return undefined
}